<?php


namespace App\Http\Controllers\Admin;


use App\Tool\Json;

class IndexModelController extends AuthCheckController
{


    function saveAd(){

        \Cache::set('index_ad',json_encode(request()->input('adList')));


        return Json::code(1,'success');

    }


    /**
     * 广告详情（命名有问题，懒得改了）
     * Create by Peter
     * 2019/11/26 09:15:08
     * Email:904801074@qq.com
     * @return false|string
     */
    function getDetail(){

        $data=\Cache::get('index_ad','[]');

        $data=json_decode($data,true);

        return Json::code(1,'success',$data);


    }

    /**
     * 存储首页消息通知
     * Create by Peter
     * 2020/07/07 14:36:57
     * Email:904801074@qq.com
     * @return false|string
     * @throws \Psr\SimpleCache\InvalidArgumentException
     */
    function saveMessage(){

        \Cache::set('index_message',json_encode(request()->input('adList')));


        return Json::code(1,'success');

    }

    /**
     * 获取消息通知
     * Create by Peter
     * 2020/07/07 14:37:09
     * Email:904801074@qq.com
     * @return false|string
     */
    function getMessageDetail(){

        $data=\Cache::get('index_message','[]');


        return Json::code(1,'success',json_decode($data,true));


    }

    function saveMode(){


        \Cache::set('index:mode_list',json_encode(request()->input('list')));


        return Json::code(1,'success');


    }

    function getMode(){

        $data=\Cache::get('index:mode_list','[]');


        return Json::code(1,'success',json_decode($data,true));

    }



}
